#coding:utf-8
import urllib.request
from bs4 import BeautifulSoup
import codecs

#http://zhidao.baidu.com/question/1703864557907957820.html

response  = urllib.request.urlopen("http://baike.baidu.com/view/21087.htm")
soup = BeautifulSoup(response.read(),'html.parser',from_encoding='utf-8')
dd = soup.find(name = 'dd',attrs={'class':'lemmaWgt-lemmaTitle-title'}).find('h1')
summary_node = soup.find('div',class_="lemma-summary")
print(summary_node.get_text().encode('utf-8'))
print(dd.get_text())
fount = codecs.open('text.html', 'w', 'utf-8')
fount.write('以以')
fount.close()
